package p270jp.pxv.android.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import androidx.databinding.DataBindingUtil;
import p014ae.View$OnClickListenerC0090h7;
import p014ae.View$OnClickListenerC0156s7;
import p014ae.View$OnClickListenerC0159t4;
import p045be.View$OnClickListenerC1095o;
import p090d0.C2518n;
import p134ei.PixivAnalytics;
import p159fi.FirebaseEventLogger;
import p270jp.pxv.android.R;
import p270jp.pxv.android.legacy.model.PixivIllustSeries;
import p270jp.pxv.android.model.PixivIllustSeriesContext;
import p307l9.EdgeTreatment;
import p314lg.DetailIllustSeriesViewBinding;
import p325m0.MutabilityOwnership;
import p603wm.AbstractC6949c;
import p677zi.PixivImageLoader;

/* renamed from: jp.pxv.android.view.DetailIllustSeriesView */
/* loaded from: classes2.dex */
public class DetailIllustSeriesView extends RelativeLayout {

    /* renamed from: e */
    public static final /* synthetic */ int f19490e;

    /* renamed from: a */
    public DetailIllustSeriesViewBinding f19491a = (DetailIllustSeriesViewBinding) DataBindingUtil.m11370c(LayoutInflater.from(getContext()), R.layout.detail_illust_series_view, this, true);

    /* renamed from: b */
    public AbstractC6949c<PixivAnalytics> f19492b = C2518n.m7638h(PixivAnalytics.class);

    /* renamed from: c */
    public AbstractC6949c<FirebaseEventLogger> f19493c = C2518n.m7638h(FirebaseEventLogger.class);

    /* renamed from: d */
    public AbstractC6949c<PixivImageLoader> f19494d = C2518n.m7638h(PixivImageLoader.class);

    public DetailIllustSeriesView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    /* renamed from: a */
    public void m4501a(PixivIllustSeries pixivIllustSeries, PixivIllustSeriesContext pixivIllustSeriesContext) {
        EdgeTreatment.m3909i(pixivIllustSeriesContext);
        if (pixivIllustSeriesContext.next == null) {
            this.f19491a.f22385u.setText(getContext().getString(R.string.series_next_empty));
            Context context = getContext();
            MutabilityOwnership.m3745m(context, "context");
            TypedValue typedValue = new TypedValue();
            if (context.getTheme().resolveAttribute(R.attr.colorCharcoalText3, typedValue, true)) {
                this.f19491a.f22385u.setTextColor(typedValue.data);
                this.f19491a.f22386v.setVisibility(8);
                this.f19491a.f22384t.setVisibility(8);
                this.f19491a.f22387w.setOnClickListener(null);
                Context context2 = getContext();
                MutabilityOwnership.m3745m(context2, "context");
                TypedValue typedValue2 = new TypedValue();
                if (context2.getTheme().resolveAttribute(R.attr.colorCharcoalSurface2, typedValue2, true)) {
                    this.f19491a.f22383s.setBackgroundColor(typedValue2.data);
                } else {
                    throw new IllegalStateException("Charcoal Theme, もしくは Charcoal Bridge Theme を利用してください");
                }
            } else {
                throw new IllegalStateException("Charcoal Theme, もしくは Charcoal Bridge Theme を利用してください");
            }
        } else {
            this.f19491a.f22385u.setText(R.string.series_next);
            this.f19491a.f22386v.setVisibility(0);
            this.f19491a.f22386v.setText(pixivIllustSeriesContext.next.title);
            this.f19491a.f22384t.setVisibility(0);
            int dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.next_illust_image_size);
            this.f19494d.getValue().m54l(getContext(), pixivIllustSeriesContext.next.imageUrls.getMedium(), dimensionPixelSize, dimensionPixelSize, this.f19491a.f22383s, 15);
            this.f19491a.f22387w.setOnClickListener(new View$OnClickListenerC0156s7(this, pixivIllustSeriesContext, 4));
        }
        this.f19491a.f22382r.setText(pixivIllustSeries.title);
        this.f19491a.f22382r.setOnClickListener(new View$OnClickListenerC1095o(this, pixivIllustSeries, 9));
        if (pixivIllustSeriesContext.prev == null) {
            this.f19491a.f22388x.setVisibility(8);
        } else {
            this.f19491a.f22388x.setOnClickListener(new View$OnClickListenerC0159t4(this, pixivIllustSeriesContext, 9));
            this.f19491a.f22388x.setVisibility(0);
        }
        this.f19491a.f22381q.setOnClickListener(new View$OnClickListenerC0090h7(this, pixivIllustSeries, 5));
    }
}
